<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>file对象</title>
</head>
<body>
    <!-- <input type="file" id="fileItem"> -->
    <input type="file" onchange="onChange(event)">
    <script>
        // var file = document.getElementById("fileItem").files[0]
        // console.log(file)

        function onChange(event){
            var file = event.target.files[0];
            var reader = new FileReader()
            reader.onload = event=>{
                console.log(event.target.result)
            }
            reader.readAsText(file)
        }
    </script>
</body>
</html>